#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int main()
{
    printf("start\n");
    pid_t pid = fork();
    if(pid==0)
    {
        printf("child process\n");
        //execl("/usr/bin/ls","ls","-al",NULL);
        //execl("./code","./code",NULL);
        //execlp("ls","ls","-al",NULL);
        char *const argv[] = {(char* const)"./code",(char* const)"-a",(char* const)"-l",NULL};
        //execv("/usr/bin/ls",argv);
        //execvp("ls",argv);
        char *const env[] = {(char* const)"PATH=/usr/bin",NULL};
        putenv((char*)"MyVal=123456789");
        extern char **environ;
        execvpe("./code",argv,environ);
    }
    waitpid(pid,NULL,0);
    printf("parent process\n");
    return 0;
}
